{% load i18n %}
{% load fb_tags %}

<script type="text/javascript">
if (typeof jQuery != 'undefined') {
    $(document).ready(function(){
       $('.filterset h3').click(function() {
           $(this).parent().toggleClass('collapse-closed');
           $(this).parent().toggleClass('collapse-open');
           $(this).next().next().toggle();
       });
    });
}
</script>

<div id="changelist-filter">
    <h2>{% trans "Filter" %}</h2>
    {% if query.filter_date %}
    <div class="filterset collapse-open">
    {% else %}
    <div class="filterset collapse-closed">
    {% endif %}
    <h3>{% trans "By Date" %}</h3>
    <ul id="Date">
         {% if query.filter_date %}<li>{% else %}<li class="selected">{% endif %}<a href="{% query_string "" "filter_date" %}">{% trans "Any Date" %}</a></li>
         {% ifequal query.filter_date 'today' %}<li class="selected">{% else %}<li>{% endifequal %}
         <a href="{% query_string "" "filter_date" %}&amp;filter_date=today">{% trans "Today" %}</a></li>
         {% ifequal query.filter_date 'past7days' %}<li class="selected">{% else %}<li>{% endifequal %}
         <a href="{% query_string "" "filter_date" %}&amp;filter_date=past7days">{% trans "Past 7 days" %}</a></li>
         {% ifequal query.filter_date 'thismonth' %}<li class="selected">{% else %}<li>{% endifequal %}
         <a href="{% query_string "" "filter_date" %}&amp;filter_date=thismonth">{% trans "Past 30 days" %}</a></li>
         {% ifequal query.filter_date 'thisyear' %}<li class="selected">{% else %}<li>{% endifequal %}
         <a href="{% query_string "" "filter_date" %}&amp;filter_date=thisyear">{% trans "This year" %}</a></li>
    </ul>
    </div>
    {% if query.filter_type %}
    <div class="filterset collapse-open">
    {% else %}
    <div class="filterset collapse-closed">
    {% endif %}
    <h3>{% trans "By Type" %}</h3>
    <ul id="Type">
        {% if query.filter_type %}<li>{% else %}<li class="selected">{% endif %}<a href="{% query_string "" "filter_type" %}">{% trans "All" %}</a></li>
        {% for extension in settings_var.EXTENSIONS %}
        {% ifequal query.filter_type extension %}<li class="selected">{% else %}<li>{% endifequal %}<a href="{% query_string "" "filter_type" %}&amp;filter_type={{ extension }}">{% trans extension %}</a></li>
        {% endfor %}
    </ul>
    </div>
</div>